﻿<%@ WebService Language="C#" Class="WebServices" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Reflection;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class WebServices  : System.Web.Services.WebService 
{

	/// <summary>
	/// 
	/// </summary>
	/// <param name="procedure"></param>
	/// <param name="args"></param>
	/// <returns></returns>
	[WebMethod]
	public string Database(string procedure, string args)
	{
		try
		{
			//Split up the arguments we're passing to the Database
			//by ' , ' and throw it into an object[]
			object[] temp = null;
			if (args != null)
			{
				if (args != "")
				{
					if (args != "null")
					{
						temp = args.Split(',');
					}
				}
			}

			//Reflectively invoke the database stored procedure
			Type t = typeof(DatabaseManager);
			return t.InvokeMember(procedure, BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, temp).ToString();
		}
		catch (Exception e)
		{
			return e.Message;
		}
	}
	
	
	
	
	
	//=======================================OLD SHIT=======================================================
	//=======================================OLD SHIT=======================================================
	
	
	//[WebMethod]
	//public string GetProjectNames(string category) 
	//{
	//    return null;
	//    //return DatabaseManager.GetProjectNames(category);
	//}

	//[WebMethod]
	//public string GetProjectHighlights(int projectID)
	//{
	//    return DatabaseManager.GetProjectHighlights(projectID);
	//}

	//[WebMethod]
	//public string GetProjectImage(int projectID)
	//{
	//    return DatabaseManager.GetProjectImage(projectID);
	//}

	//[WebMethod]
	//public string GetProjectStatus(int projectID)
	//{
	//    return DatabaseManager.GetProjectStatus(projectID);
	//}

	//[WebMethod]
	//public string GetProjectTitle(int projectID)
	//{
	//    return DatabaseManager.GetProjectTitle(projectID);
	//}

	//[WebMethod]
	//public string Search(string projectID)
	//{
	//    return DatabaseManager.GetProjectTitle(projectID);
	//}
}
